package com.zty.bjcrm.service.Impl;

import com.zty.bjcrm.mapper.OrderMapper;
import com.zty.bjcrm.model.CosOrder;
import com.zty.bjcrm.model.PageResult;
import com.zty.bjcrm.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class IOrderServiceImpl  implements IOrderService {

    @Autowired
    OrderMapper orderMapper;

    @Override
    public PageResult<CosOrder> findPageResult(CosOrder condition, int page, int pageSize) {
        PageResult<CosOrder> result = new PageResult<CosOrder>();
        result.setCode(0);
        /*
        * 查询参数设置为空
        * */
        Map<String,Object> params = new HashMap<String,Object>();
        //获取总记录数
        int totalCount = orderMapper.findCountByMap(params);
        result.setCount(totalCount);

        //获取查询数据
        List<CosOrder> list = orderMapper.findListByMap(params);
        result.setData(list);

        return result;
    }
}
